package com.frcdi.qms.equipment.service.impl;

import com.frcdi.qms.equipment.domain.EquipmentCycleConfig;
import com.frcdi.qms.equipment.mapper.EquipmentCycleConfigMapper;
import com.frcdi.qms.equipment.service.IEquipmentCycleConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 设备生命周期配置Service业务层处理
 *
 * @author cell
 * @date 2023-12-12
 */
@Service
public class EquipmentCycleConfigServiceImpl implements IEquipmentCycleConfigService
{
    @Autowired
    private EquipmentCycleConfigMapper equipmentCycleConfigMapper;

    /**
     * 查询设备生命周期配置
     *
     * @param configId 设备生命周期配置主键
     * @return 设备生命周期配置
     */
    @Override
    public EquipmentCycleConfig selectEquipmentCycleConfigByConfigId(Long configId)
    {
        return equipmentCycleConfigMapper.selectEquipmentCycleConfigByConfigId(configId);
    }

    /**
     * 查询设备生命周期配置列表
     *
     * @param equipmentCycleConfig 设备生命周期配置
     * @return 设备生命周期配置
     */
    @Override
    public List<EquipmentCycleConfig> selectEquipmentCycleConfigList(EquipmentCycleConfig equipmentCycleConfig)
    {
        return equipmentCycleConfigMapper.selectEquipmentCycleConfigList(equipmentCycleConfig);
    }

    @Override
    public List<EquipmentCycleConfig> selectEquipmentCycleConfigByStatus(EquipmentCycleConfig equipmentCycleConfig)
    {
        EquipmentCycleConfig equipmentCycle= new EquipmentCycleConfig();
        equipmentCycle.setEquipmentId(equipmentCycleConfig.getEquipmentId());
        equipmentCycle.setBeforeStatus(equipmentCycleConfig.getBeforeStatus());
        equipmentCycle.setEndStatus(equipmentCycleConfig.getEndStatus());
        return equipmentCycleConfigMapper.selectEquipmentCycleConfigList(equipmentCycle);
    }

    /**
     * 新增设备生命周期配置
     *
     * @param equipmentCycleConfig 设备生命周期配置
     * @return 结果
     */
    @Override
    public int insertEquipmentCycleConfig(EquipmentCycleConfig equipmentCycleConfig)
    {
        return equipmentCycleConfigMapper.insertEquipmentCycleConfig(equipmentCycleConfig);
    }

    /**
     * 修改设备生命周期配置
     *
     * @param equipmentCycleConfig 设备生命周期配置
     * @return 结果
     */
    @Override
    public int updateEquipmentCycleConfig(EquipmentCycleConfig equipmentCycleConfig)
    {
        return equipmentCycleConfigMapper.updateEquipmentCycleConfig(equipmentCycleConfig);
    }

    /**
     * 批量删除设备生命周期配置
     *
     * @param configIds 需要删除的设备生命周期配置主键
     * @return 结果
     */
    @Override
    public int deleteEquipmentCycleConfigByConfigIds(Long[] configIds)
    {
        return equipmentCycleConfigMapper.deleteEquipmentCycleConfigByConfigIds(configIds);
    }

    /**
     * 删除设备生命周期配置信息
     *
     * @param configId 设备生命周期配置主键
     * @return 结果
     */
    @Override
    public int deleteEquipmentCycleConfigByConfigId(Long configId)
    {
        return equipmentCycleConfigMapper.deleteEquipmentCycleConfigByConfigId(configId);
    }

}
